package com.lineage.server.datatables.lock;

import com.lineage.server.datatables.sql.MaryTable;
import com.lineage.server.datatables.storage.MaryStorage;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class MaryReading {
  private final Lock _lock = new ReentrantLock(true);
  
  private final MaryStorage _storage = (MaryStorage)new MaryTable();
  
  private static MaryReading _instance;
  
  public static MaryReading get() {
    if (_instance == null)
      _instance = new MaryReading(); 
    return _instance;
  }
  
  public void load() {
    this._lock.lock();
    try {
      this._storage.load();
    } finally {
      this._lock.unlock();
    } 
  }
  
  public void update(long all_stake, long all_user_prize, int count) {
    this._lock.lock();
    try {
      this._storage.update(all_stake, all_user_prize, count);
    } finally {
      this._lock.unlock();
    } 
  }
}
